{extend name='common@layout/seller' /}
{block name="left"}{include file='goods/left'}{/block}
{block name="breadcrumb"}
<div class="ncsc-path"><i class="icon-desktop"></i>商家管理中心<i class="icon-angle-right"></i>商品<i class="icon-angle-right"></i>商品管理</div>
{/block}
{block name='content'}
<div class="tabmenu">
    <ul class="tab pngFix">
        {eq name='type' value='online'}
            <li class="active"><a href="{:url('seller/goods/index')}">出售中的商品</a></li>
            {else /}
            <li class="active"><a href="{:url('seller/goods/offline')}">仓库中的商品</a></li>
            <!--
            <li class="normal"><a  href="{:url('seller/goods/lock_up')}">违规的商品</a></li>
            <li class="normal"><a  href="{:url('seller/goods/wait_verify')}">等待审核的商品</a></li>
            -->
        {/eq}
    </ul>
        {eq name='type' value='online'}
        <a href="/?s=seller/goods/cate" class="ncsc-btn ncsc-btn-green" title="发布新商品"> 发布新商品</a>
        {/eq}
</div>
    <form method="get" action="{:url($url)}">
    <table class="search-form">
        <tr>
            <td>&nbsp;</td>
            <th>本店分类</th>
            <td class="w160">
                <select name="stc_id" class="w150">
                    <option value="0">请选择...</option>
                    <?php foreach ($store_goods_class as $val) { ?>
                    <option value="<?php echo $val['id']; ?>" <?php if (input('stc_id/d')==$val['id']) { ?>selected="selected"<?php } ?>><?php echo $val['name']; ?></option>
                    <?php if (is_array($val['_child']) && count($val['_child'])>0){?>
                    <?php foreach ($val['_child'] as $child_val){?>
                    <option value="<?php echo $child_val['id']; ?>" <?php if (input('stc_id/d')==$child_val['id']) { ?>selected="selected"<?php } ?>>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $child_val['name']; ?></option>
                    <?php }?>
                    <?php }?>
                    <?php } ?>
                </select>
            </td>
            <th> <select name="search_type">
                    <option value="0">商品名称</option>
                    <option value="1" {eq name='$Think.get.search_type' value='1'}selected{/eq}>商家货号</option>
                    <option value="2" {eq name='$Think.get.search_type' value='2'}selected{/eq}>平台货号</option>
                </select>
            </th>
            <td class="w160">
                <input type="text" class="text w150" name="keyword" value="{$Think.get.keyword|default=''}"/>
            </td>
            <td class="tc w70">
                <label class="submit-border">
                    <input type="submit" class="submit" value="搜索" />
                </label>
            </td>
        </tr>
    </table>
</form>
<table class="ncsc-default-table">
    <thead>
        <tr nc_type="table_header">
            <th class="w30">&nbsp;</th>
            <th class="w50">&nbsp;</th>
            <th coltype="editable" column="goods_name" checker="check_required" inputwidth="230px">商品名称</th>
            <th class="w100">价格</th>
            <th class="w100">库存</th>
            <th class="w100">{eq name='type' value='online'}发布时间{else/}上架{/eq}</th>
            <th class="w120">操作</th>
        </tr>
        {notempty name='goods_list'}
        <tr>
            <td class="tc"><input type="checkbox" id="all" class="checkall"/></td>
            <td colspan="20"><label for="all" >全选</label>
                <a href="javascript:void(0);" class="ncsc-btn-mini" nc_type="batchbutton" uri="/?s=seller/goods/drop" name="commonid" confirm="您确定要删除吗?"><i class="icon-trash"></i>删除</a> 
                <a href="javascript:void(0);" class="ncsc-btn-mini" nc_type="batchbutton" uri="/?s=seller/goods/{eq name='type' value='online'}unshow{else/}show{/eq}" name="commonid"><i class="icon-level-down"></i>{eq name='type' value='online'}下架{else/}上架{/eq}</a> 
                <a href="javascript:void(0);" class="ncsc-btn-mini" nctype="batch" data-param="{ url:'/?s=seller/goods/ad_word', sign:'jingle'}"><i></i>设置广告词</a> 
                <a href="javascript:void(0);" class="ncsc-btn-mini" nctype="batch" data-param="{ url:'/?s=seller/goods/plate', sign:'plate'}"><i></i>设置关联版式</a></td>
        </tr>
        {/notempty}
    </thead>
    <tbody>
        {notempty name='goods_list'}
        {foreach $goods_list as $one}
        <tr>
            <th class="tc"><input type="checkbox" class="checkitem tc"  value="{$one.id}"/></th>
            <th colspan="20">平台货号：{$one.id}</th>
        </tr>
        <tr>
            <td class="trigger">
                <i class="tip icon-plus-sign" nctype="ajaxGoodsList" data-comminid="{$one.id}" title="点击展开查看此商品全部规格；规格值过多时请横向拖动区域内的滚动条进行浏览。"></i>
            </td>
            <td>
                <div class="pic-thumb">
                    <a href="{:url('index/goods/detail?goods_id='.$storage[$one['id']]['goods_id'])}" target="_blank">
                        <img alt="{$one.goods_name}" src="{$one.goods_image|img_url=360}" onerror="this.src='/old/data/upload/shop/common/default_goods_image_60.gif'"/>
                    </a>
                </div>
            </td>
            <td class="tl"><dl class="goods-name">
                    <dt style="max-width: 450px !important;">
                        <a href="{:url('index/goods/detail?goods_id='.$storage[$one['id']]['goods_id'])}" target="_blank">{$one.goods_name}</a></dt>
                    <dd>商家货号：{$one.goods_serial|default='未设置'}</dd>
                    <dd class="serve"> 
                        {eq name='one.goods_commend' value='1'}
                        <span class="open" title="店铺推荐商品"><i class="commend">荐</i></span> 
                        {/eq}
                    </dd>
                </dl></td>
            <td><span>&yen;{$one.goods_price}</span></td>
            <td><span >{$storage[$one['id']]['sum']}件</span></td>
            {eq name='type' value='online'}
            <td class="goods-time">{$one.goods_addtime|date='Y-m-d',###}</td>
            {else/}
            <td>
                <a href="javascript:void(0)" onclick="ajax_get_confirm('','/?s=seller/goods/show&commonid={$one.id}')" class="ncsc-btn">上架</a>
            </td>
            {/eq}
            <td class="nscs-table-handle">        
                <span>
                    <a href="/?s=seller/goods/modify&commonid={$one.id}" class="btn-blue">
                        <i class="icon-edit"></i>
                        <p>编辑</p>
                    </a>
                </span> 
                <span>
                    <a href="javascript:void(0);" onclick="ajax_get_confirm('您确定要删除吗?', '/?s=seller/goods/drop&commonid={$one.id}');" class="btn-red">
                        <i class="icon-trash"></i>
                        <p>删除</p>
                    </a>
                </span>
            </td>
        </tr>
        <tr style="display:none;">
            <td colspan="20"><div class="ncsc-goods-sku ps-container"></div></td>
        </tr>
        {/foreach}
    <tfoot>
        <tr>
            <th class="tc"><input type="checkbox" id="all" class="checkall"/></th>
            <th colspan="10"><label for="all" >全选</label>
                <a href="javascript:void(0);" class="ncsc-btn-mini" nc_type="batchbutton" uri="/?s=seller/goods/drop" name="commonid" confirm="您确定要删除吗?"><i class="icon-trash"></i>删除</a> 
                <a href="javascript:void(0);" class="ncsc-btn-mini" nc_type="batchbutton" uri="/?s=seller/goods/{eq name='type' value='online'}unshow{else/}show{/eq}" name="commonid"><i class="icon-level-down"></i>{eq name='type' value='online'}下架{else/}上架{/eq}</a> 
                <a href="javascript:void(0);" class="ncsc-btn-mini" nctype="batch" data-param="{ url:'/?s=seller/goods/ad_word', sign:'jingle'}"><i></i>设置广告词</a> 
                <a href="javascript:void(0);" class="ncsc-btn-mini" nctype="batch" data-param="{ url:'/?s=seller/goods/plate', sign:'plate'}"><i></i>设置关联版式</a></th>
        </tr>
        <tr>
            <td colspan="10">{$pager}</td>
        </tr>
    </tfoot>
        {else /}
        <tr>
            <td colspan="10" class="norecord"><div class="warning-option"><i class="icon-warning-sign"></i><span>暂无符合条件的数据记录</span></div></td>
        </tr>
        {/notempty}
</table>
<script src="/old/data/resource/js/jquery.poshytip.min.js?v1.2"></script> 
<script src="/old/shop/resource/js/store_goods_list.js?v1.2"></script> 
<script>
                        $(function () {
                            $('.tip').poshytip({
                                className: 'tip-yellowsimple',
                                showTimeout: 1,
                                alignTo: 'target',
                                alignX: 'center',
                                alignY: 'top',
                                offsetY: 5,
                                allowTipHover: false
                            });
                            $('a[nctype="batch"]').click(function () {
                                if ($('.checkitem:checked').length == 0) {
                                    showDialog('请选择需要操作的记录');
                                    return false;
                                }
                                var _items = '';
                                $('.checkitem:checked').each(function () {
                                    _items += $(this).val() + ',';
                                });
                                _items = _items.substr(0, (_items.length - 1));

                                var data_str = '';
                                eval('data_str = ' + $(this).attr('data-param'));

                                if (data_str.sign == 'jingle') {
                                    ajax_form('ajax_jingle', '设置广告词', data_str.url + '&commonid=' + _items + '&inajax=1', '480');
                                } else if (data_str.sign == 'plate') {
                                    ajax_form('ajax_plate', '设置关联版式', data_str.url + '&commonid=' + _items + '&inajax=1', '480');
                                }
                            });
                        });
</script>
{/block}